package app.common.utils.cjt.vo;

import lombok.Data;

import java.math.BigDecimal;
import java.util.Map;

/**
 * inventory statement响应对象
 * @author feizns
 * @since 2023/09/09
 */
@Data
public class InventoryStatementVo {

    /**
     * 商家编码
     */
    private String merchantCode;

    /**
     * 仓库名称
     */
    private String warehouseName;

    /**
     * 库存
     */
    private BigDecimal inventory;

    /**
     * @param data {@link Map}
     * @return {@link InventoryStatementVo}
     */
    public static InventoryStatementVo from(Map<String, Object> data) {
        InventoryStatementVo vo = new InventoryStatementVo();
        vo.setInventory(BigDecimal.valueOf(((Number) data.getOrDefault("numberField_lbbzp1q2", 0D)).doubleValue()));
        vo.setMerchantCode((String) data.get("textField_lbbzp1px"));
        vo.setWarehouseName((String) data.get("textField_lbbzp1q3"));
        return vo;
    }

}
